<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>选择时刻复杂版</title>
		<style type="text/css">
			#div001{
				width: 100%;
				height: 800px;
				display: flex;
				justify-content: center;
			}
			#div002{
				width: 600px;
				height: 500px;
				overflow: hidden;
			}
			#img_id1{
				width: 1600px;
				height: 100px;
				display: flex;
				align-items: center;
				justify-content: center;
				margin-top: 200px;
			}
			#img_id1 img{
				width: 100px;
				height: 100px;
			}
		</style>
	</head>
	<body>
		<div id="div001">
			<div id="div002">
				<div id="img_id1" onmouseenter="doMouseEnterAction();" onmouseleave="doMouseLeaveAction();">
					<img src="../img/1.jpeg" >
					<img src="../img/2.jpeg" >
					<img src="../img/6.jpeg" >
					<img src="../img/4.jpeg" >
					<img src="../img/5.jpeg" >
					<img src="../img/6.jpeg" >
					<img src="../img/7.jpeg" >
					<img src="../img/8.jpeg" >
					<img src="../img/9.jpeg" >
					<img src="../img/10.jpeg" >
					<img src="../img/1.jpeg" >
					<img src="../img/2.jpeg" >
					<img src="../img/6.jpeg" >
					<img src="../img/4.jpeg" >
					<img src="../img/5.jpeg" >
				</div>
			</div>
		</div>
	</body>
	<script type="text/javascript">
		var imgObj = document.getElementById('img_id1');
		var marginLeft = 0;
		var marginLeft1 = null;
		var marginLeft2 = null;
		
		function doAction(){
			if (marginLeft == -1000) {
				marginLeft = 0
			}
			marginLeft --;
			imgObj.style.marginLeft = marginLeft + 'px';
			if (marginLeft%100 == 0) {
				clearInterval(marginLeft1);
				marginLeft2 = setTimeout(function(){
					marginLeft1 = setInterval(doAction,50);
				},1000)
			}
		}
		function doMouseEnterAction(){
			clearInterval(marginLeft1);
			clearInterval(marginLeft2);
		}
		function doMouseLeaveAction(){
			
			marginLeft1 = setInterval(doAction,50);
		}
		onload = function(){
			marginLeft1 = setInterval(doAction,50)
		}
	</script>
</html>
